home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1922 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  963 b 

  1. Path: news.bridge.net!news
  2. From: David Byrden <100101.2547@compuserve.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: const member functions
  5. Date: 14 Jan 1996 04:29:03 GMT
  6. Organization: self-employed
  7. Message-ID: <4da0qf$6v3@news.bridge.net>
  8. References: <4d8d8f$b30@oznet07.ozemail.com.au>
  9. NNTP-Posting-Host: ppp-mia2-95.bridge.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
  14.  
  15.  
  16. Oliver;
  17.  
  18. A member function marked 'const' will not modify any of the
  19. data members of its object; this is enforced by C++. This 
  20. includes not calling non-const member functions.
  21.  
  22. The idea is that when you declare a class object const, 
  23. you will truly be unable to modify it. However, the 
  24. compiler cannot prevent you modifying other resources that the
  25. class object owns, such as heap memory, and so you need
  26. to program carefully in order to design clases which are
  27. truly "const-corect".
  28.  
  29.    David
  30.  
  31.  
  32.